<?php

namespace App\Models;

class Prize extends Model
{
    protected $fillable = [
        'product_id', 'status', 'quantity', 'remain_quantity', 'redeeming_quantity', 'redeemed_quantity',
        'user_redeeming_quantity', 'accumulate_point', 'shelves_begin', 'shelves_end', 'redeeming_begin',
        'redeeming_end', 'redeemed_begin', 'redeemed_end', 'order_num', 'delflag'
    ];

    public function product()
    {
        return $this->belongsTo(Product::class, 'product_id');
    }

    public function prizeRecords()
    {
        return $this->hasMany(PrizeRecord::class, 'prize_id');
    }

    public function redeemLogs()
    {
        return $this->hasMany(RedeemLog::class, 'prize_id');
    }
}
